﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using YArchitech.LIB.YJKControls;

namespace YJKArch.ImportStructureProject
{
	public partial class ImportOptionForm : System.Windows.Forms.Form
	{
		public bool ImportWall
		{
			get
			{
				return this.chbWall.Checked && this.chbWall.Enabled;
			}
		}

		public bool ImportBeam
		{
			get
			{
				return this.chbBeam.Checked && this.chbBeam.Enabled;
			}
		}

		public bool ImportColumn
		{
			get
			{
				return this.chbColumn.Checked && this.chbColumn.Enabled;
			}
		}

		public bool ImportFloor
		{
			get
			{
				return this.chbFloor.Checked && this.chbFloor.Enabled;
			}
		}

		public ElementId DefaultRectangeBeamFamilyId
		{
			get
			{
				if (!this.cmbRectangleBeam.Enabled)
				{
					return null;
				}
				return this.m_RectBeamFamilyList[this.cmbRectangleBeam.SelectedIndex].Id;
			}
		}

		public ElementId DefaultRectangeColumnFamilyId
		{
			get
			{
				if (!this.cmbRectangleColumn.Enabled)
				{
					return null;
				}
				return this.m_RectColumnFamilyList[this.cmbRectangleColumn.SelectedIndex].Id;
			}
		}

		public ElementId DefaultCircleColumnFamilyId
		{
			get
			{
				if (!this.cmbCircleColumn.Enabled)
				{
					return null;
				}
				return this.m_CircleColumnFamilyList[this.cmbCircleColumn.SelectedIndex].Id;
			}
		}

		public ElementId DefaultWallTypeId
		{
			get
			{
				if (!this.cmbWall.Enabled)
				{
					return null;
				}
				return this.m_WallTypeList[this.cmbWall.SelectedIndex].Id;
			}
		}

		public ElementId DefaultFloorTypeId
		{
			get
			{
				if (!this.cmbFloor.Enabled)
				{
					return null;
				}
				return this.m_FloorTypeList[this.cmbFloor.SelectedIndex].Id;
			}
		}

		public ImportOptionForm(int importWallCount, List<Element> wallTypeList, int importFloorCount, List<Element> floorTypeList, int importRectColumnCount, List<Element> rectColumnSymbolList, int importCircleCount, List<Element> circleColumnSymbolList, int importRectBeam, List<Element> rectBeamSymbolList)
		{
			this.m_WallTypeList = wallTypeList;
			this.m_FloorTypeList = floorTypeList;
			this.m_RectBeamFamilyList = rectBeamSymbolList;
			this.m_RectColumnFamilyList = rectColumnSymbolList;
			this.m_CircleColumnFamilyList = circleColumnSymbolList;
			this.InitializeComponent();
			this.InitializeComponentDate(importWallCount, importFloorCount, importRectColumnCount, importCircleCount, importRectBeam);
		}

		private void InitializeComponentDate(int importWallCount, int importFloorCount, int importRectColumnCount, int importCircleCount, int importRectBeam)
		{
			if (importRectColumnCount < 1 && importCircleCount < 1)
			{
				this.chbColumn.Checked = false;
				this.chbColumn.Enabled = false;
			}
			if (importRectColumnCount > 0)
			{
				foreach (Element element in this.m_RectColumnFamilyList)
				{
					Family family = element as Family;
					this.cmbRectangleColumn.Items.Add(family.Name);
				}
				if (this.m_RectColumnFamilyList.Count == 0)
				{
					this.cmbRectangleColumn.Enabled = false;
				}
				else
				{
					this.cmbRectangleColumn.SelectedIndex = 0;
				}
			}
			else
			{
				this.cmbRectangleColumn.Enabled = false;
			}
			if (importCircleCount > 0)
			{
				foreach (Element element2 in this.m_CircleColumnFamilyList)
				{
					Family family2 = element2 as Family;
					this.cmbCircleColumn.Items.Add(family2.Name);
				}
				if (this.m_CircleColumnFamilyList.Count == 0)
				{
					this.cmbCircleColumn.Enabled = false;
				}
				else
				{
					this.cmbCircleColumn.SelectedIndex = 0;
				}
			}
			else
			{
				this.cmbCircleColumn.Enabled = false;
			}
			if (importRectBeam > 0)
			{
				foreach (Element element3 in this.m_RectBeamFamilyList)
				{
					Family family3 = element3 as Family;
					this.cmbRectangleBeam.Items.Add(family3.Name);
				}
				if (this.m_RectBeamFamilyList.Count == 0)
				{
					this.cmbRectangleBeam.Enabled = false;
				}
				else
				{
					this.cmbRectangleBeam.SelectedIndex = 0;
				}
			}
			else
			{
				this.chbBeam.Checked = false;
				this.chbBeam.Enabled = false;
				this.cmbRectangleBeam.Enabled = false;
			}
			if (importWallCount > 0)
			{
				foreach (Element element4 in this.m_WallTypeList)
				{
					WallType wallType = element4 as WallType;
					this.cmbWall.Items.Add(wallType.Name);
				}
				if (this.m_WallTypeList.Count == 0)
				{
					this.cmbWall.Enabled = false;
				}
				else
				{
					this.cmbWall.SelectedIndex = 0;
				}
			}
			else
			{
				this.chbWall.Checked = false;
				this.chbWall.Enabled = false;
				this.cmbWall.Enabled = false;
			}
			if (importFloorCount <= 0)
			{
				this.chbFloor.Checked = false;
				this.chbFloor.Enabled = false;
				this.cmbFloor.Enabled = false;
				return;
			}
			foreach (Element element5 in this.m_FloorTypeList)
			{
				FloorType floorType = element5 as FloorType;
				this.cmbFloor.Items.Add(floorType.Name);
			}
			if (this.m_FloorTypeList.Count == 0)
			{
				this.cmbFloor.Enabled = false;
				return;
			}
			this.cmbFloor.SelectedIndex = 0;
		}

		private List<Element> m_WallTypeList = new List<Element>();

		private List<Element> m_FloorTypeList = new List<Element>();

		private List<Element> m_RectBeamFamilyList = new List<Element>();

		private List<Element> m_RectColumnFamilyList = new List<Element>();

		private List<Element> m_CircleColumnFamilyList = new List<Element>();
	}
}
